package cn.htcode.mybatisplus01.MetaObjectHandler;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author: Mr_he
 * @BelongsProject:homework
 * @BelongsPackage:cn.htcode.mybatisplus01.MetaObjectHandler
 * @CreateTime:2024-12-27
 * @Version:1.0
 */
@Slf4j
@Component
public class MyMetaObjectHandler implements MetaObjectHandler {
    @Override
    public void insertFill(MetaObject metaObject) {
        log.info("开始插入填充...");
        setFieldValByName("createTime", new Date(), metaObject);
//        this.strictInsertFill(metaObject, "createTime", LocalDateTime.class, LocalDateTime.now());

    }

    @Override
    public void updateFill(MetaObject metaObject) {
        log.info("开始更新填充...");
        setFieldValByName("updateTime", new Date(), metaObject);
//        this.strictUpdateFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now());

    }
}
